﻿using XYTXL.API;
using XYTXL.AppCode;
using XYTXL.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YanWF;

namespace XYTXL.View.UCMangForm
{
    public partial class ZiDian : FormUControl
    {

        public string strType
        {
            get
            {
                return Request.QueryString["Type"].ToString();
            }
        }


        #region//添加页面

        public override void initAddForm(string strFormCode)
        {
            base.initAddForm(strFormCode);
            hidType.Value = strFormCode;
        }

        /// <summary>
        /// 送审表单
        /// </summary>
        /// <param name="FormID">表单号</param>
        /// <param name="intProcessInstanceID">流程号</param>
        /// <returns></returns>
        public override bool SaveForm(int intFormID, string strActionType, int intProcessInstanceID = 0)
        {
            JH_Auth_ZiDian MODEL = new JH_Auth_ZiDianB().GetEntity(d => d.ID == intFormID);
            if (strActionType == "ADD")
            {
                MODEL.TypeNO = hidType.Value;
            }
            MODEL.Class = Int32.Parse(strType);
            MODEL.TypeName = txtName.Text.Trim();
            MODEL.Remark = "0";
            MODEL.Remark1 = txtDetails.Text.Trim();

            return new JH_Auth_ZiDianB().Update(MODEL);

        }
        #endregion

        #region//查看页面
        /// <summary>
        /// 初始化View页面
        /// </summary>
        /// <param name="intFormID">表单号</param>
        public override void initMangerForm(int intFormID, string strAction)
        {
            JH_Auth_ZiDian MODEL = new JH_Auth_ZiDianB().GetEntity(d => d.ID == intFormID);
            txtName.Text = MODEL.TypeName;
            txtDetails.Text = MODEL.Remark1;
        }
        #endregion

    }
}